﻿<%@ Page Title="Change Password" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="ChangePassword.aspx.cs" Inherits="ankietyzacja.Account.ChangePassword" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Zmień hasło
    </h2>
    <p>
        Skorzystaj z poniższego formularza, aby zmienić hasło.
        <asp:Table ID="Table1" runat="server" Height="522px" Width="901px">
            <asp:TableRow>
                <asp:TableCell>
                    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="UserId"
                        DataSourceID="UserSqlDataSource" Height="50px" Width="125px">
                        <Fields>
                            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                            <asp:BoundField DataField="PasswordQuestion" HeaderText="Pytanie przypominajace hasło"
                                SortExpression="PasswordQuestion" />
                            <asp:BoundField DataField="PasswordAnswer" HeaderText="Odpowiedź na pytanie przypominające hasło"
                                SortExpression="PasswordAnswer" />
                            <asp:BoundField DataField="LastLoginDate" HeaderText="Data ostatniego logowania"
                                SortExpression="LastLoginDate" />
                        </Fields>
                    </asp:DetailsView>
                    <asp:SqlDataSource ID="UserSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ankietyzacjaConnectionString %>"
                        DeleteCommand="DELETE FROM aspnet_Membership" InsertCommand="INSERT INTO aspnet_Membership(ApplicationId, UserId, Password, PasswordSalt, PasswordFormat, MobilePIN, Email, PasswordQuestion, PasswordAnswer, LoweredEmail, IsApproved, IsLockedOut, CreateDate, LastLoginDate, LastPasswordChangedDate, LastLockoutDate, FailedPasswordAttemptCount, FailedPasswordAttemptWindowStart, FailedPasswordAnswerAttemptCount, FailedPasswordAnswerAttemptWindowStart, Comment) VALUES (,,,,,,,,,,,,,,,,,,,,)"
                        OnSelecting="SqlDataSource1_Selecting" SelectCommand="SELECT aspnet_Membership.* FROM aspnet_Membership"
                        UpdateCommand="UPDATE aspnet_Membership SET Password =, Email =, PasswordQuestion =, PasswordAnswer =">
                    </asp:SqlDataSource>
                </asp:TableCell>
                <asp:TableCell>
                    <asp:ChangePassword ID="ChangeUserPassword" runat="server" CancelDestinationPageUrl="~/"
                        EnableViewState="false" RenderOuterTable="false" SuccessText="Hasło zostało zmienione"
                        SuccessTitleText="" ContinueButtonText="Kontynuuj" ContinueDestinationPageUrl="ChangePassword.aspx">
                        <ChangePasswordTemplate>
                            <span class="failureNotification">
                                <asp:Literal ID="FailureText" runat="server"></asp:Literal>
                            </span>
                            <asp:ValidationSummary ID="ChangeUserPasswordValidationSummary" runat="server" CssClass="failureNotification"
                                ValidationGroup="ChangeUserPasswordValidationGroup" />
                            <div class="accountInfo">
                                <fieldset class="changePassword">
                                    <p>
                                        <asp:Label ID="CurrentPasswordLabel" runat="server" AssociatedControlID="CurrentPassword">Stare hasło:</asp:Label>
                                        <asp:TextBox ID="CurrentPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="CurrentPasswordRequired" runat="server" ControlToValidate="CurrentPassword"
                                            CssClass="failureNotification" ErrorMessage="Wymagane jest wprowadzenie dotychczasowego hasła."
                                            ToolTip="Stare hasło jest wymagane." ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
                                    </p>
                                    <p>
                                        <asp:Label ID="NewPasswordLabel" runat="server" AssociatedControlID="NewPassword">Nowe hasło:</asp:Label>
                                        <asp:TextBox ID="NewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="NewPasswordRequired" runat="server" ControlToValidate="NewPassword"
                                            CssClass="failureNotification" ErrorMessage="Wymagane jest wprowadzenie nowego hasła."
                                            ToolTip="Nowe hasło jest wymagane." ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
                                    </p>
                                    <p>
                                        <asp:Label ID="ConfirmNewPasswordLabel" runat="server" AssociatedControlID="ConfirmNewPassword">Potwierdź nowe hasło:</asp:Label>
                                        <asp:TextBox ID="ConfirmNewPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="ConfirmNewPasswordRequired" runat="server" ControlToValidate="ConfirmNewPassword"
                                            CssClass="failureNotification" Display="Dynamic" ErrorMessage="Potwierdzenie nowego hasła jest wymagane."
                                            ToolTip="Potwierdzenie nowego hasła jest wymagane." ValidationGroup="ChangeUserPasswordValidationGroup">*</asp:RequiredFieldValidator>
                                        <asp:CompareValidator ID="NewPasswordCompare" runat="server" ControlToCompare="NewPassword"
                                            ControlToValidate="ConfirmNewPassword" CssClass="failureNotification" Display="None"
                                            ErrorMessage="Potwierdzenie hasła niezgodne z wcześniej wprowadzonym nowym hasłem."
                                            ValidationGroup="ChangeUserPasswordValidationGroup" Font-Bold="True">*</asp:CompareValidator>
                                    </p>
                                </fieldset>
                                <p class="submitButton">
                                    <asp:Button ID="CancelPushButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                        Text="Anuluj" />
                                    <asp:Button ID="ChangePasswordPushButton" runat="server" CommandName="ChangePassword"
                                        Text="Zmień hasło" ValidationGroup="ChangeUserPasswordValidationGroup" />
                                </p>
                                <p>
                                    Nowe hasło musi mieć minimum
                                    <%= Membership.MinRequiredPasswordLength %>
                                    znaków.
                                </p>
                            </div>
                        </ChangePasswordTemplate>
                    </asp:ChangePassword>
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </p>
</asp:Content>
